<template>
    <hd-login :loginStyle="loginStyle" :fun="beforeLogin"></hd-login>
</template>

<script>
import { mapActions } from 'vuex'

export default {
  data () {
    return {
      loginStyle: {
        backgroundImage: 'url(http://house-manager.oss-cn-qingdao.aliyuncs.com/ctcm/%E5%9B%BE%E7%89%87/%E5%81%A5%E5%BA%B7%E7%A0%81%E7%AE%A1%E7%90%86%E5%90%8E%E5%8F%B0.png)'
      }
    }
  },
  methods: {
    ...mapActions([
      'getUserInfo'
    ]),
    async beforeLogin () {
      let rest = await this.getUserInfo()
      if (rest.errcode === 0) {
        return true
      } else {
        this.$Message.error('获取用户信息失败')
        return false
      }
    }
  }
}
</script>
